package Thread.singleton_pattern;

/**
 * 饿汉式单例模式
 * 这个类一加载到JVM中，这个唯一的对象就产生了
 */
 public class singletest1 {
    private static singletest1 single=new singletest1();
    private singletest1(){}

    public static singletest1 getSingletest() {
        return single;
    }
}

class singletest1Main{
    public static void main(String[] args) {
        singletest1 s1= singletest1.getSingletest();
        singletest1 s2= singletest1.getSingletest();
        singletest1 s3= singletest1.getSingletest();
        System.out.println(s1==s2);
        System.out.println(s1==s3);
    }
}

